library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity regestband is
Port ( CZ : in std_logic;
CV : in std_logic;
CC : in std_logic;
CN : in std_logic;
UPAZ : in std_logic;
UPAV : in std_logic;
UPAC : in std_logic;
UPAN : in std_logic;
XN : in std_logic;
XZ : in std_logic;
YN : in std_logic;
YZ : in std_logic;
RAN : in std_logic;
RAZ : in std_logic;
PCN : in std_logic;
PCZ : in std_logic;
ACCAN : in std_logic;
ACCAZ : in std_logic;
ACCBN : in std_logic;
ACCBZ : in std_logic;
B : in std_logic_vector(8 downto 0);
--HB: in std_logic;
banderaN : out std_logic;
banderaZ : out std_logic;
banderaV : out std_logic;
banderaC : out std_logic);
--salidab : out std_logic_vector (7 downto 0));

end regestband;

architecture Behavioral of regestband is

begin
process(CC,B)
begin
if(CC='1') 
	then if(B(0)='0')
		  then banderac <= UPAC;
		  --else banderac <= '0';
		  end if;
else banderac <= '0';
end if;
end process;

process(CV,B)
begin
if(CV='1') 
	then if(B(2 downto 1) = "00")
				then banderav <= UPAV;
		  else if(B(2 downto 1)= "10")
				then banderav <= '0';
				end if;
			end if;
   else banderav <= '0'; 
end if;
end process;

process(CZ,B)
begin
if(CZ='1') 
	then if(B(5 downto 3)="000")
				then banderaz <= UPAZ;
		  elsif(B(5 downto 3)="001")
				then banderaz <= ACCAZ;
		  elsif(B(5 downto 3)="010")
				then banderaz <= ACCBZ;
		  elsif(B(5 downto 3)="011")
				then banderaz <= XZ;
		  elsif(B(5 downto 3)="100")
				then banderaz <= '0';
		  elsif(B(5 downto 3)="101")	
				then banderaz <= pcz;
		end if;
   else banderaz <= '0'; 
end if;
end process;

process(CN,B)
begin
if(CN='1') 
	then if(B(8 downto 6)="000")
				then banderan <= UPAN;
		  elsif(B(8 downto 6)="001")
				then banderan <= ACCAN;
		  elsif(B(8 downto 6)="010")
				then banderan <= ACCBN;
		  elsif(B(8 downto 6)="011")
				then banderan <= XN;
		  elsif(B(8 downto 6)="100")
				then banderan <= '0';
		  elsif(B(8 downto 6)="101")	
				then banderan <= pcn;
		end if;
   else banderan <= '0'; 
end if;
end process;

end Behavioral;